import logo from './logo.svg';
import './App.css';
import { useState, componentDidMount, useEffect } from 'react';

function App() {
  const [a, setA] = useState(0)

  useEffect(() => {
    let timer = setInterval(() => {
      console.log(111);
      console.log(a);

    console.log(a,'111');
    
  }, 3000)
  return () => {
    clearInterval(timer)
  }
  }, [a])

  const increase = () => {
    setA(a + 1)
  }

  return <div>
    <div>{a}</div>
    <button onClick={increase}>+1</button>
  </div>

}

export default App;
